using Microsoft.Extensions.Configuration;

namespace Configuration.DataBase.Extensions
{
	public static class DbConfigurationProviderExtensions
	{
		public static IConfigurationBuilder AddDbConfiguration(this IConfigurationBuilder builder, 
			Action<ConfigurationDatabaseOptions>? config = null)
		{
			var options = new ConfigurationDatabaseOptions();
			config?.Invoke(options);
			var source = new ConfigurationDatabaseSource(options);
			builder.Add(source);
			return builder;
		}
	}
}
